package oop1;

/**
 * @author oldliu
 * @since 1.0
 */
public class Visitor {
    String name;
    int age;

    public void calcMoney() {
        if (age < 0) {
            System.out.println("请输入正确的年龄！");
        } else if (age <= 14 || age > 60) {
            System.out.println(name + "年龄为" + age + ",门票免费");
        } else if (age < 18) {
            System.out.println(name + "年龄为" + age + ",门票半价");
        } else {
            System.out.println(name + "年龄为" + age + ",门票全票");
        }
    }
}
